<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<br><br>
<table border="1" cellspacing="1" cellpadding="1" style="border-collapse: collapse">
    <thead>
        <tr style="background-color:#ff7673">
            <th>Id</th>
            <th>Restaurante</th>
            <th>Direccion</th>
            <th>Telefono</th>
            <th>Acciones</th>
        </tr>
    </thead>
    <tbody>



        <c:if test="${not empty respuestaGrid}">
 
            <c:set var="num" value="1"></c:set>
            
            <c:forEach items="${respuestaGrid}" var="restaurante">
                <c:set var="estilo" value="style=\"background:#00782d;\""></c:set>
                <c:if test="${num%2==0}">
                    <c:set var="estilo" value="style=\"\""></c:set>
                </c:if>
                <tr ${estilo}>
                    <td>${num}</td>
                    <td>${restaurante.restaurante}</td>
                    <td>${restaurante.direccion}</td>
                    <td>${restaurante.telefono}</td>   
                    <td>
                        <c:url value="/dml.ufg" var="deleteAl">
                            <c:param name="action" value="remove"/>
                            <c:param name="idrestaurante" value="${restaurante.idrestaurante}"/>
                        </c:url>

                        <a href="${deleteAl}"><img src="../img/Delete.png" border="0"></a>


                        <c:url value="/app/update.jsp" var="editAl">
                            <c:param name="action" value="edit"/>
                            <c:param name="idrestaurante" value="${restaurante.idrestaurante}"/>
                            <c:param name="restaurante" value="${restaurante.restaurante}"/>
                            <c:param name="direccion" value="${restaurante.direccion}"/>
                            <c:param name="telefono" value="${restaurante.telefono}"/>
                        </c:url>

                        <a href="${editAl}"><img src="../img/Modify.png" border="0"></a>

                    </td>
                </tr>
                <c:set var="num" value="${num+1}"></c:set>
            </c:forEach>

            <c:remove scope="session" var="respuestaGrid"/>

        </c:if>

        <c:if test="${not empty errores}">

            <c:forEach items="${errores}" var="error">

                <tr>
                    <td colspan="6">${error}</td>
                </tr>

            </c:forEach>
            <c:remove scope="session" var="errores"/>
        </c:if>
    </tbody>
</table>